added SSCLI 1.0
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2010 / VBWebBrowserAutomation / MainForm.vb
blob783e131c9460275cc7e2ea29b940151afc2395c1
1 '*************************** Module Header ******************************'
2 ' Module Name: MainForm.vb
3 ' Project: VBWebBrowserAutomation
4 ' Copyright (c) Microsoft Corporation.
5 '
6 ' This is the main form of this application. It is used to initialize the UI and
7 ' handle the events.
8 '
9 ' This source is subject to the Microsoft Public License.
10 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
11 ' All other rights reserved.
13 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
14 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
15 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
16 '*************************************************************************'
18 Imports System.Security.Permissions
20 Partial Public Class MainForm
21 Inherits Form
23 <PermissionSetAttribute(SecurityAction.LinkDemand, Name:="FullTrust")>
24 Public Sub New()
25 InitializeComponent()
27 ' Register the events.
28 AddHandler webBrowser.Navigating, AddressOf webBrowser_Navigating
29 AddHandler webBrowser.DocumentCompleted, AddressOf webBrowser_DocumentCompleted
30 End Sub
32 ''' <summary>
33 ''' Disable the btnAutoComplete when webBrowser is navigating.
34 ''' </summary>
35 Private Sub webBrowser_Navigating(ByVal sender As Object,
36 ByVal e As WebBrowserNavigatingEventArgs)
37 btnAutoComplete.Enabled = False
38 End Sub
40 ''' <summary>
41 ''' Refresh the UI after the web page is loaded.
42 ''' </summary>
43 Private Sub webBrowser_DocumentCompleted(ByVal sender As Object,
44 ByVal e As WebBrowserDocumentCompletedEventArgs)
45 btnAutoComplete.Enabled = webBrowser.CanAutoComplete
46 tbUrl.Text = e.Url.ToString()
47 End Sub
49 ''' <summary>
50 ''' Handle the Click event of btnAutoComplete_
51 ''' </summary>
52 Private Sub btnAutoComplete_Click(ByVal sender As Object,
53 ByVal e As EventArgs) Handles btnAutoComplete.Click
54 Try
55 webBrowser.AutoComplete()
56 Catch ex As Exception
57 MessageBox.Show(ex.Message)
58 End Try
59 End Sub
61 ''' <summary>
62 ''' Hanle the Click event of the btnGo.
63 ''' </summary>
64 Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click
65 Try
66 webBrowser.Navigate(tbUrl.Text)
67 Catch ex As Exception
68 MessageBox.Show(ex.Message)
69 End Try
70 End Sub
71 End Class